package org.example;

import org.example.cglibproxy.MethodProxy;
import org.example.cglibproxy.Say;
import org.example.jdkproxy.ProxyFactory;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        ISpeak p = ProxyFactory.getProxy(ISpeak.class, new ISpeak() {
            @Override
            public void say(String msg) {
                System.out.println("msg = " + msg);
            }
        });
        p.say("hello world");
        System.out.println("p = " + p);

        Say say = new Say();
        Say p2 = new MethodProxy().getInstance(say);
        p2.say("hello world");
    }
}